package util.Graph;

public class Node implements Comparable {
    private static int _count = 0;
    
    private int _key;
    
    
    Node () {
        _key = _count;
        _count++;
    }
    
    
    public boolean equals(Object obj) {
        if (obj instanceof Node) {
            Node other = (Node) obj;
            return _key == other._key;
        }
        else return false;
    }
    
    
    public int compareTo(Object obj) {
        if (obj instanceof Node) {
            Node other = (Node) obj;
            if (_key < other._key) {
                  return -1;
            }
            else if (_key == other._key) {
                return 0;
            }
            else {
                return 1;
            }
        }
        else throw new ClassCastException();
    }
    
    
    public String toString() {
        return "n" + _key;
    }
}
